#include <iostream>
#include "BinomialHeap.cpp"

using namespace std;

class DataLoad
{
    public:
    unsigned int key1;
	BinomialHeapNode<DataLoad>* node;

    DataLoad (int key)
    {
        this->key1 = key;
		this->node = NULL;
    }
};

int main()
{
    DataLoad* data1 = new DataLoad(10);
    DataLoad* data2 = new DataLoad(20);
    DataLoad* data3 = new DataLoad(30);
    DataLoad* data4 = new DataLoad(40);
    DataLoad* data5 = new DataLoad(50);
    DataLoad* data6 = new DataLoad(60);
    DataLoad* data7 = new DataLoad(70);
    DataLoad* data8 = new DataLoad(80);
    DataLoad* data9 = new DataLoad(90);
    DataLoad* data10 = new DataLoad(150);

    BinomialHeap<DataLoad>* heap = new BinomialHeap<DataLoad>();

	heap->insert(data1, &(data1->key1), &(data1->node));
    heap->insert(data2, &(data2->key1), &(data2->node));
    heap->insert(data3, &(data3->key1), &(data3->node));
    heap->insert(data4, &(data4->key1), &(data4->node));
    heap->insert(data5, &(data5->key1), &(data5->node));
    heap->insert(data6, &(data6->key1), &(data6->node));
    heap->insert(data7, &(data7->key1), &(data7->node));
    heap->insert(data8, &(data8->key1), &(data8->node));
    heap->insert(data9, &(data9->key1), &(data9->node));
    
    heap->insert(data10, &(data10->key1), &(data10->node));

    //heap->displayBFS();
    //heap->decreaseKey(node, 9);
    //heap->displayBFS();
    //cout<<minR->key1;
    //heap->displayBFS();
    //minR = heap->removeMin();
    cout<<"\n\n\nRemoveMin is "<<heap->removeMin()->key1;
    heap->displayBFS();
    //cout<<"\n\nAddress of node: "<<node;
    //heap->decreaseKey(node, 9);
    //cout<<"\n\nAddress of node after decrease Key: "<<node;
    //heap->displayBFS();
    cout<<"\n\n\nRemovedMin: "<<heap->removeMin()->key1;
    heap->displayBFS();
    cout<<"\n\nDecreaseKey Called for node notice change of address\n";
	heap->decreaseKey(data10->node, 3);
    heap->displayBFS();
	heap->decreaseKey(data10->node, 1);
	heap->displayBFS();
    cout<<"\n\n\nRemovedMin: "<<heap->removeMin()->key1;
    heap->displayBFS();
    cout<<"\n\n\nRemovedMin: "<<heap->removeMin()->key1;
    heap->displayBFS();
    cout<<"\n\n\nRemovedMin: "<<heap->removeMin()->key1;
    heap->displayBFS();
    cout<<"\n\n\nRemovedMin: "<<heap->removeMin()->key1;
    heap->displayBFS();
    cout<<"\n\n\nRemovedMin: "<<heap->removeMin()->key1;
    heap->displayBFS();
    //cout<<"\n\nDecreaseKey Called for node notice change of address\n";
    //heap->decreaseKey(node, 3);
    //heap->displayBFS();
    cout<<"\n\n\nRemovedMin: "<<heap->removeMin()->key1;
    heap->displayBFS();
    cout<<"\n\n\nRemovedMin: "<<heap->removeMin()->key1;
    heap->displayBFS();
    cout<<"\n\n\nRemovedMin: "<<heap->removeMin()->key1;
    heap->displayBFS();

    //heap->displayBFS();
	cout<<"\n\nAddress of node after removing that Key: "<<data10->node;
    //heap->displayBFS();
    cout << "Hello world!" << endl;
    int temp;
    cin>>temp;
    cout<<temp;
    return 0;
}
